// --------------------------------------------------------------------------------------------------------------------
// <copyright file="RoleEnvironmentChangingEventArgs.cs" company="AzureContrib (Open source library http://azurecontrib.codeplex.com)">
//   Microsoft Public License (Ms-PL)
// </copyright>
// <summary>
//   Represents the arguments for the Changing event, which occurs before a configuration change is applied to a role instance.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace AzureContrib.WindowsAzure.ServiceRuntime
{
	/// <summary>
	/// Represents the arguments for the Changing event, which occurs before a configuration change is applied to a role instance.
	/// </summary>
	/// <remarks>Abstracts out Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironmentChangingEventArgs</remarks>
	public class RoleEnvironmentChangingEventArgs : CancelEventArgs
	{
		private List<RoleEnvironmentChange> changes;

		/// <summary>
		/// Initializes a new instance of the <see cref="RoleEnvironmentChangingEventArgs"/> class. 
		/// </summary>
		/// <param name="roleEnvironmentChanges">
		/// The changes to the Role Environment.
		/// </param>
		public RoleEnvironmentChangingEventArgs(IEnumerable<RoleEnvironmentChange> roleEnvironmentChanges)
		{
			changes = new List<RoleEnvironmentChange>(roleEnvironmentChanges);
		}

		/// <summary>
		/// Gets the changes to the configuration
		/// </summary>
		public ReadOnlyCollection<RoleEnvironmentChange> Changes
		{
			get
			{
				return changes.AsReadOnly();
			}
		}
	}
}